package org.auslides.security.shiro.stateless;

import org.apache.shiro.mgt.DefaultSubjectFactory;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.subject.SubjectContext;
import org.apache.shiro.web.mgt.DefaultWebSubjectFactory;

public class StalessSubjectFactory extends DefaultWebSubjectFactory {

    public Subject createSubject(SubjectContext context) {
        //不创建session, 如果之后调用Subject.getSession()将抛出DisabledSessionException异常。
        context.setSessionCreationEnabled(false);
        return super.createSubject(context);
    }
}
